FROM golang:1.16-alpine AS build
#替换源
#RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
ENV GOPROXY https://goproxy.cn
ENV GO111MODULE on
WORKDIR /go/src/project/
COPY . /go/src/project/
RUN go mod download

RUN CGO_ENABLED=0 go build -mod=mod -o /bin/httpserver
FROM alpine
COPY --from=build /bin/httpserver  /bin/httpserver
ENTRYPOINT ["/bin/httpserver"]
CMD ["-alsologtostderr","-log_dir=log"]
